milkee 0.0.0 โ†’ 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,41 +1,47 @@
1
- name: Release
1
+ name: Manual Publish to npm
2
2
 
3
3
  on:
4
- push:
5
- tags:
6
- - "v*"
4
+ workflow_dispatch:
7
5
 
8
6
  jobs:
9
- publish:
10
- name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
11
- runs-on: ${{ matrix.os }}
12
- timeout-minutes: 10
13
- strategy:
14
- matrix:
15
- node-version: [20.x]
16
- os: [ubuntu-latest]
17
-
7
+ publish-npm:
8
+ runs-on: ubuntu-latest
18
9
  permissions:
19
- contents: read
20
10
  id-token: write
21
-
11
+ contents: write
22
12
  steps:
23
- - name: Checkout ๐Ÿ””
13
+ - name: Checkout repository
24
14
  uses: actions/checkout@v4
25
15
 
26
- - name: Setup Node.js ${{ matrix.node-version }} ๐Ÿ”ง
16
+ - name: Setup Node.js
27
17
  uses: actions/setup-node@v4
28
18
  with:
29
- node-version: ${{ matrix.node-version }}
30
- registry-url: 'https://registry.npmjs.org'
31
-
32
- - name: Install dependencies ๐Ÿงน
33
- run: npm ci
34
-
35
- - name: Build ๐Ÿ”จ
36
- run: npm run build
37
-
38
- - name: Publish ๐ŸŽ
19
+ node-version: "20.x"
20
+ registry-url: "https://registry.npmjs.org"
21
+
22
+ - name: Install, Build, and Test
23
+ run: |
24
+ npm ci
25
+ npm run build
26
+ npm test
27
+
28
+ - name: Commit dist directory (if changed)
29
+ run: |
30
+ git config --global user.name "github-actions[bot]"
31
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
32
+ git add dist
33
+ # The following command creates a commit ONLY if there are staged changes.
34
+ git diff --staged --quiet || git commit -m "chore: update build artifacts"
35
+ git push
36
+
37
+ - name: Publish to npm
39
38
  run: npm publish --provenance --access public
40
39
  env:
41
40
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41
+
42
+ - name: Create and Push Git Tag
43
+ run: |
44
+ # This step now runs after the dist commit, ensuring the tag points to the correct commit.
45
+ VERSION=$(node -p "require('./package.json').version")
46
+ git tag "v$VERSION"
47
+ git push origin "v$VERSION"
package/dist/bin.js CHANGED
@@ -1,126 +1,122 @@
1
- // Generated by CoffeeScript 2.7.0
2
- (function() {
3
- //!/usr/bin/env node
4
- var CONFIG_FILE, CONFIG_PATH, CWD, TEMPLATE_PATH, argv, compile, consola, exec, fs, hideBin, path, pkg, setup, yargs;
1
+ #!/usr/bin/env node;
2
+ var CONFIG_FILE, CONFIG_PATH, CWD, TEMPLATE_PATH, argv, compile, consola, exec, fs, hideBin, path, pkg, setup, yargs;
5
3
 
6
- yargs = require('yargs');
4
+ yargs = require('yargs');
7
5
 
8
- ({hideBin} = require('yargs/helpers'));
6
+ ({hideBin} = require('yargs/helpers'));
9
7
 
10
- consola = require('consola');
8
+ consola = require('consola');
11
9
 
12
- fs = require('fs');
10
+ fs = require('fs');
13
11
 
14
- path = require('path');
12
+ path = require('path');
15
13
 
16
- ({exec} = require('child_process'));
14
+ ({exec} = require('child_process'));
17
15
 
18
- pkg = require('../package.json');
16
+ pkg = require('../package.json');
19
17
 
20
- CWD = process.cwd();
18
+ CWD = process.cwd();
21
19
 
22
- CONFIG_FILE = 'coffee.config.js';
20
+ CONFIG_FILE = 'coffee.config.js';
23
21
 
24
- CONFIG_PATH = path.join(CWD, CONFIG_FILE);
22
+ CONFIG_PATH = path.join(CWD, CONFIG_FILE);
25
23
 
26
- TEMPLATE_PATH = path.join(__dirname, '..', 'temp', 'coffee.config.js');
24
+ TEMPLATE_PATH = path.join(__dirname, '..', 'temp', 'coffee.config.js');
27
25
 
28
- setup = function() {
29
- var error;
30
- if (fs.existsSync(CONFIG_PATH)) {
31
- consola.warn(`\`${CONFIG_FILE}\` already exists in this directory.`);
32
- return;
26
+ setup = function() {
27
+ var error;
28
+ if (fs.existsSync(CONFIG_PATH)) {
29
+ consola.warn(`\`${CONFIG_FILE}\` already exists in this directory.`);
30
+ return;
31
+ }
32
+ try {
33
+ fs.writeFileSync(CONFIG_PATH, CONFIG_TEMPLATE);
34
+ return consola.success(`Successfully created \`${CONFIG_FILE}\`.`);
35
+ } catch (error1) {
36
+ error = error1;
37
+ return consola.error(`Failed to create \`${CONFIG_FILE}\`:`, error);
38
+ }
39
+ };
40
+
41
+ compile = async(async function() {
42
+ var command, commandParts, config, configPathUrl, error, key, options, otherOptionStrings, value;
43
+ if (!fs.existsSync(CONFIG_PATH)) {
44
+ consola.error(`\`${CONFIG_FILE}\` not found.`);
45
+ consola.info('Please run `milkee --setup` to create a configuration file.');
46
+ process.exit(1);
47
+ }
48
+ try {
49
+ configPathUrl = path.toFileUrl(CONFIG_PATH).href;
50
+ ({
51
+ default: config
52
+ } = (await import(configPathUrl)));
53
+ if (!(config.entry && config.output)) {
54
+ consola.error('`entry` and `output` properties are required in your configuration.');
55
+ process.exit(1);
33
56
  }
34
- try {
35
- fs.writeFileSync(CONFIG_PATH, CONFIG_TEMPLATE);
36
- return consola.success(`Successfully created \`${CONFIG_FILE}\`.`);
37
- } catch (error1) {
38
- error = error1;
39
- return consola.error(`Failed to create \`${CONFIG_FILE}\`:`, error);
57
+ options = config.options || {};
58
+ commandParts = ['coffee'];
59
+ if (options.join) {
60
+ commandParts.push('--join');
61
+ commandParts.push(`\"${config.output}\"`);
62
+ } else {
63
+ commandParts.push('--output');
64
+ commandParts.push(`\"${config.output}\"`);
40
65
  }
41
- };
42
-
43
- compile = async(async function() {
44
- var command, commandParts, config, configPathUrl, error, key, options, otherOptionStrings, value;
45
- if (!fs.existsSync(CONFIG_PATH)) {
46
- consola.error(`\`${CONFIG_FILE}\` not found.`);
47
- consola.info('Please run `milkee --setup` to create a configuration file.');
48
- process.exit(1);
66
+ delete options.join;
67
+ otherOptionStrings = [];
68
+ for (key in options) {
69
+ value = options[key];
70
+ if (value === true) {
71
+ otherOptionStrings.push(`--${key}`);
72
+ } else if (value !== false) {
73
+ otherOptionStrings.push(`--${key} \"${value}\"`);
74
+ }
75
+ }
76
+ if (otherOptionStrings.length > 0) {
77
+ commandParts.push(otherOptionStrings.join(' '));
49
78
  }
50
- try {
51
- configPathUrl = path.toFileUrl(CONFIG_PATH).href;
52
- ({
53
- default: config
54
- } = (await import(configPathUrl)));
55
- if (!(config.entry && config.output)) {
56
- consola.error('`entry` and `output` properties are required in your configuration.');
79
+ commandParts.push('--compile');
80
+ commandParts.push(`\"${config.entry}\"`);
81
+ command = commandParts.filter(Boolean).join(' ');
82
+ consola.start(`Compiling from \`${config.entry}\` to \`${config.output}\`...`);
83
+ consola.info(`Executing: ${command}`);
84
+ return exec(command, function(error, stdout, stderr) {
85
+ if (error) {
86
+ consola.error('Compilation failed:', error);
87
+ if (stderr) {
88
+ process.stderr.write(stderr);
89
+ }
57
90
  process.exit(1);
91
+ return;
58
92
  }
59
- options = config.options || {};
60
- commandParts = ['coffee'];
61
- if (options.join) {
62
- commandParts.push('--join');
63
- commandParts.push(`\"${config.output}\"`);
64
- } else {
65
- commandParts.push('--output');
66
- commandParts.push(`\"${config.output}\"`);
93
+ consola.success('Compilation completed successfully!');
94
+ if (stdout) {
95
+ process.stdout.write(stdout);
67
96
  }
68
- delete options.join;
69
- otherOptionStrings = [];
70
- for (key in options) {
71
- value = options[key];
72
- if (value === true) {
73
- otherOptionStrings.push(`--${key}`);
74
- } else if (value !== false) {
75
- otherOptionStrings.push(`--${key} \"${value}\"`);
76
- }
77
- }
78
- if (otherOptionStrings.length > 0) {
79
- commandParts.push(otherOptionStrings.join(' '));
97
+ if (stderr) {
98
+ return process.stderr.write(stderr);
80
99
  }
81
- commandParts.push('--compile');
82
- commandParts.push(`\"${config.entry}\"`);
83
- command = commandParts.filter(Boolean).join(' ');
84
- consola.start(`Compiling from \`${config.entry}\` to \`${config.output}\`...`);
85
- consola.info(`Executing: ${command}`);
86
- return exec(command, function(error, stdout, stderr) {
87
- if (error) {
88
- consola.error('Compilation failed:', error);
89
- if (stderr) {
90
- process.stderr.write(stderr);
91
- }
92
- process.exit(1);
93
- return;
94
- }
95
- consola.success('Compilation completed successfully!');
96
- if (stdout) {
97
- process.stdout.write(stdout);
98
- }
99
- if (stderr) {
100
- return process.stderr.write(stderr);
101
- }
102
- });
103
- } catch (error1) {
104
- error = error1;
105
- consola.error('Failed to load or execute configuration:', error);
106
- return process.exit(1);
107
- }
108
- });
109
-
110
- argv = yargs(hideBin(process.argv)).scriptName('milkee').usage('$0 [command]').option('setup', {
111
- alias: 's',
112
- describe: 'Generate a default coffee.config.js',
113
- type: 'boolean'
114
- }).option('compile', {
115
- alias: 'c',
116
- describe: 'Compile CoffeeScript based on coffee.config.js (default)',
117
- type: 'boolean'
118
- }).version('version', pkg.version).alias('v', 'version').help('help').alias('h', 'help').argv;
119
-
120
- if (argv.setup) {
121
- setup();
122
- } else {
123
- compile();
100
+ });
101
+ } catch (error1) {
102
+ error = error1;
103
+ consola.error('Failed to load or execute configuration:', error);
104
+ return process.exit(1);
124
105
  }
125
-
126
- }).call(this);
106
+ });
107
+
108
+ argv = yargs(hideBin(process.argv)).scriptName('milkee').usage('$0 [command]').option('setup', {
109
+ alias: 's',
110
+ describe: 'Generate a default coffee.config.js',
111
+ type: 'boolean'
112
+ }).option('compile', {
113
+ alias: 'c',
114
+ describe: 'Compile CoffeeScript based on coffee.config.js (default)',
115
+ type: 'boolean'
116
+ }).version('version', pkg.version).alias('v', 'version').help('help').alias('h', 'help').argv;
117
+
118
+ if (argv.setup) {
119
+ setup();
120
+ } else {
121
+ compile();
122
+ }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "milkee",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "description": "A simple CoffeeScript build tool with coffee.config.js",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {
7
7
  "milkee": "dist/cli.js"
8
8
  },
9
9
  "scripts": {
10
- "build": "coffee --output dist/ --compile src/",
11
- "prepublishOnly": "npm run build"
10
+ "test": "echo \"No test specified\" && exit 0",
11
+ "build": "coffee --bare --no-header --output dist/ --compile src/"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
package/src/bin.coffee DELETED
@@ -1,109 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- yargs = require 'yargs'
4
- { hideBin } = require 'yargs/helpers'
5
- consola = require 'consola'
6
- fs = require 'fs'
7
- path = require 'path'
8
- { exec } = require 'child_process'
9
-
10
- pkg = require '../package.json'
11
- CWD = process.cwd()
12
- CONFIG_FILE = 'coffee.config.js'
13
- CONFIG_PATH = path.join(CWD, CONFIG_FILE)
14
-
15
- TEMPLATE_PATH = path.join(__dirname, '..', 'temp', 'coffee.config.js')
16
-
17
- setup = () ->
18
- if fs.existsSync(CONFIG_PATH)
19
- consola.warn "`#{CONFIG_FILE}` already exists in this directory."
20
- return
21
-
22
- try
23
- fs.writeFileSync(CONFIG_PATH, CONFIG_TEMPLATE)
24
- consola.success "Successfully created `#{CONFIG_FILE}`."
25
- catch error
26
- consola.error "Failed to create `#{CONFIG_FILE}`:", error
27
-
28
- compile = async () ->
29
- unless fs.existsSync(CONFIG_PATH)
30
- consola.error "`#{CONFIG_FILE}` not found."
31
- consola.info 'Please run `milkee --setup` to create a configuration file.'
32
- process.exit(1)
33
-
34
- try
35
- configPathUrl = path.toFileUrl(CONFIG_PATH).href
36
- { default: config } = await import(configPathUrl)
37
-
38
- unless config.entry and config.output
39
- consola.error '`entry` and `output` properties are required in your configuration.'
40
- process.exit(1)
41
-
42
- options = config.options or {}
43
- commandParts = ['coffee']
44
-
45
- if options.join
46
- commandParts.push('--join')
47
- commandParts.push("\"#{config.output}\"")
48
- else
49
- commandParts.push('--output')
50
- commandParts.push("\"#{config.output}\"")
51
-
52
- delete options.join
53
-
54
- otherOptionStrings = []
55
- for key, value of options
56
- if value is true
57
- otherOptionStrings.push("--#{key}")
58
- else if value isnt false
59
- otherOptionStrings.push("--#{key} \"#{value}\"")
60
-
61
- if otherOptionStrings.length > 0
62
- commandParts.push(otherOptionStrings.join(' '))
63
-
64
- commandParts.push('--compile')
65
- commandParts.push("\"#{config.entry}\"")
66
-
67
- command = commandParts.filter(Boolean).join(' ')
68
-
69
- consola.start "Compiling from `#{config.entry}` to `#{config.output}`..."
70
- consola.info "Executing: #{command}"
71
-
72
- exec command, (error, stdout, stderr) ->
73
- if error
74
- consola.error 'Compilation failed:', error
75
- if stderr then process.stderr.write stderr
76
- process.exit(1)
77
- return
78
-
79
- consola.success 'Compilation completed successfully!'
80
- if stdout then process.stdout.write stdout
81
- if stderr then process.stderr.write stderr
82
-
83
- catch error
84
- consola.error 'Failed to load or execute configuration:', error
85
- process.exit(1)
86
-
87
- argv = yargs(hideBin(process.argv))
88
- .scriptName('milkee')
89
- .usage('$0 [command]')
90
- .option('setup', {
91
- alias: 's',
92
- describe: 'Generate a default coffee.config.js',
93
- type: 'boolean'
94
- })
95
- .option('compile', {
96
- alias: 'c',
97
- describe: 'Compile CoffeeScript based on coffee.config.js (default)',
98
- type: 'boolean'
99
- })
100
- .version('version', pkg.version)
101
- .alias('v', 'version')
102
- .help('help')
103
- .alias('h', 'help')
104
- .argv
105
-
106
- if argv.setup
107
- setup()
108
- else
109
- compile()