Skip to content

Commit

Permalink
feat: Implement all messages
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Mar 23, 2024
1 parent b25241f commit a6b66dc
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 14 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2021-2023 Blaine Bublitz <[email protected]> and Eric Schoffstall <[email protected]>.
Copyright (c) 2024 Blaine Bublitz <[email protected]> and Eric Schoffstall <[email protected]>.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,40 @@

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]

PROJECT_DESCRIPTION
Symbols for all messages within gulp-cli.

## Usage

In your `.gulp.js` file:

```js
var messages = require('@gulpjs/messages');

module.exports = {
message: function (data) {
if (data.tag === messages.DESCRIPTION) {
return 'Your description override message';
}
}
};
```

## API

This project exposes various symbols assigned to keys to use for matching gulp-cli messages.

## License

MIT

<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/$PROJECT_NAME.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/$PROJECT_NAME
[npm-image]: https://img.shields.io/npm/v/$PROJECT_NAME.svg?style=flat-square
[downloads-image]: https://img.shields.io/npm/dm/%40gulpjs/messages.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/%40gulpjs/messages
[npm-image]: https://img.shields.io/npm/v/%40gulpjs/messages.svg?style=flat-square

[ci-url]: https://github.com/gulpjs/$PROJECT_NAME/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/$PROJECT_NAME/dev.yml?branch=master&style=flat-square
[ci-url]: https://github.com/gulpjs/%40gulpjs/messages/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/%40gulpjs/messages/dev.yml?branch=master&style=flat-square

[coveralls-url]: https://coveralls.io/r/gulpjs/$PROJECT_NAME
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/$PROJECT_NAME/master.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/gulpjs/%40gulpjs/messages
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/%40gulpjs/messages/master.svg?style=flat-square
<!-- prettier-ignore-end -->
92 changes: 92 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
'use strict';

module.exports = {
/**
* Liftoff events
*/
PRELOAD_BEFORE: Symbol.for('GULP_CLI_PRELOAD_BEFORE'),
PRELOAD_SUCCESS: Symbol.for('GULP_CLI_PRELOAD_SUCCESS'),
PRELOAD_FAILURE: Symbol.for('GULP_CLI_PRELOAD_FAILURE'),
LOADER_SUCCESS: Symbol.for('GULP_CLI_LOADER_SUCCESS'),
LOADER_FAILURE: Symbol.for('GULP_CLI_LOADER_FAILURE'),
NODE_FLAGS: Symbol.for('GULP_CLI_NODE_FLAGS'),
RESPAWNED: Symbol.for('GULP_CLI_RESPAWNED'),

/**
* Various problems that might occur
*/
UNSUPPORTED_GULP_VERSION: Symbol.for('GULP_CLI_UNSUPPORTED_GULP_VERSION'),
MISSING_GULPFILE: Symbol.for('GULP_CLI_MISSING_GULPFILE'),
MISSING_NODE_MODULES: Symbol.for('GULP_CLI_MISSING_NODE_MODULES'),
MISSING_GULP: Symbol.for('GULP_CLI_MISSING_GULP'),
YARN_INSTALL: Symbol.for('GULP_CLI_YARN_INSTALL'),
NPM_INSTALL: Symbol.for('GULP_CLI_NPM_INSTALL'),
YARN_INSTALL_GULP: Symbol.for('GULP_CLI_YARN_INSTALL_GULP'),
NPM_INSTALL_GULP: Symbol.for('GULP_CLI_NPM_INSTALL_GULP'),

/**
* Other details
*/
CWD_CHANGED: Symbol.for('GULP_CLI_CWD_CHANGED'),
DESCRIPTION: Symbol.for('GULP_CLI_DESCRIPTION'),
GULPFILE: Symbol.for('GULP_CLI_GULPFILE'),

/**
* Task system
*/
TASK_START: Symbol.for('GULP_CLI_TASK_START'),
TASK_STOP: Symbol.for('GULP_CLI_TASK_STOP'),
TASK_FAILURE: Symbol.for('GULP_CLI_TASK_FAILURE'),
TASK_MISSING: Symbol.for('GULP_CLI_TASK_MISSING'),
TASK_SYNC: Symbol.for('GULP_CLI_TASK_SYNC'),

/**
* Completions
*/
COMPLETION_TYPE_MISSING: Symbol.for('GULP_CLI_COMPLETION_TYPE_MISSING'),
COMPLETION_TYPE_UNKNOWN: Symbol.for('GULP_CLI_COMPLETION_TYPE_UNKNOWN'),

/**
* Errors
*/
PRELOAD_ERROR: Symbol.for('GULP_CLI_PRELOAD_ERROR'),
LOADER_ERROR: Symbol.for('GULP_CLI_LOADER_ERROR'),
ARGV_ERROR: Symbol.for('GULP_CLI_ARGV_ERROR'),
EXEC_ERROR: Symbol.for('GULP_CLI_EXEC_ERROR'),
TASK_ERROR: Symbol.for('GULP_CLI_TASK_ERROR'),

/**
* Help
*/
USAGE: Symbol.for('GULP_CLI_USAGE'),
FLAG_HELP: Symbol.for('GULP_CLI_FLAG_HELP'),
FLAG_VERSION: Symbol.for('GULP_CLI_FLAG_VERSION'),
FLAG_PRELOAD: Symbol.for('GULP_CLI_FLAG_PRELOAD'),
FLAG_GULPFILE: Symbol.for('GULP_CLI_FLAG_GULPFILE'),
FLAG_CWD: Symbol.for('GULP_CLI_FLAG_CWD'),
FLAG_TASKS: Symbol.for('GULP_CLI_FLAG_TASKS'),
FLAG_TASKS_SIMPLE: Symbol.for('GULP_CLI_FLAG_TASKS_SIMPLE'),
FLAG_TASKS_JSON: Symbol.for('GULP_CLI_FLAG_TASKS_JSON'),
FLAG_TASKS_DEPTH: Symbol.for('GULP_CLI_FLAG_TASKS_DEPTH'),
FLAG_COMPACT_TASKS: Symbol.for('GULP_CLI_FLAG_COMPACT_TASKS'),
FLAG_SORT_TASKS: Symbol.for('GULP_CLI_FLAG_SORT_TASKS'),
FLAG_COLOR: Symbol.for('GULP_CLI_FLAG_COLOR'),
FLAG_NO_COLOR: Symbol.for('GULP_CLI_FLAG_NO_COLOR'),
FLAG_SILENT: Symbol.for('GULP_CLI_FLAG_SILENT'),
FLAG_CONTINUE: Symbol.for('GULP_CLI_FLAG_CONTINUE'),
FLAG_SERIES: Symbol.for('GULP_CLI_FLAG_SERIES'),
FLAG_LOG_LEVEL: Symbol.for('GULP_CLI_FLAG_LOG_LEVEL'),

/**
* Task tree
*/
TASK_NAME: Symbol.for('GULP_CLI_TASK_NAME'),
TASK_DESCRIPTION: Symbol.for('GULP_CLI_TASK_DESCRIPTION'),
TASK_FLAG: Symbol.for('GULP_CLI_TASK_FLAG'),
TASK_FLAG_DESCRIPTION: Symbol.for('GULP_CLI_TASK_FLAG_DESCRIPTION'),
BOX_DRAWINGS_LIGHT_UP_AND_RIGHT: Symbol.for('GULP_CLI_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT'),
BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT: Symbol.for('GULP_CLI_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT'),
BOX_DRAWINGS_LIGHT_HORIZONTAL: Symbol.for('GULP_CLI_BOX_DRAWINGS_LIGHT_HORIZONTAL'),
BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL: Symbol.for('GULP_CLI_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL'),
BOX_DRAWINGS_LIGHT_VERTICAL: Symbol.for('GULP_CLI_BOX_DRAWINGS_LIGHT_VERTICAL'),
};
15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "",
"version": "",
"description": "",
"name": "@gulpjs/messages",
"version": "0.0.0",
"description": "Symbols for all messages within gulp-cli",
"author": "Gulp Team <[email protected]> (https://gulpjs.com/)",
"contributors": [],
"repository": "",
"contributors": [
"Blaine Bublitz <[email protected]>"
],
"repository": "gulpjs/messages",
"license": "MIT",
"engines": {
"node": ">=10.13.0"
Expand Down Expand Up @@ -37,5 +39,8 @@
"prettier": {
"singleQuote": true
},
"publishConfig": {
"access": "public"
},
"keywords": []
}
16 changes: 16 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

var expect = require('expect');

var messages = require('../index.js');

describe('messages', function () {
it('does not have a duplicate symbol', function (done) {
var seen = new Set();
Object.values(messages).forEach(function (symbol) {
expect(seen.has(symbol)).toEqual(false);
seen.add(symbol);
});
done();
});
});

0 comments on commit a6b66dc

Please sign in to comment.