milkee 0.0.7 → 0.0.8
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.
- package/dist/main.js +27 -6
- package/package.json +1 -1
- package/temp/coffee.config.js +2 -0
- package/.github/workflows/publish.yml +0 -47
package/dist/main.js
CHANGED
@@ -22,17 +22,23 @@
|
|
22
22
|
|
23
23
|
CONFIG_PATH = path.join(CWD, CONFIG_FILE);
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
// async
|
26
|
+
setup = async function() {
|
27
|
+
var CONFIG_TEMPLATE, TEMPLATE_PATH, check, error;
|
27
28
|
if (fs.existsSync(CONFIG_PATH)) {
|
28
29
|
consola.warn(`\`${CONFIG_FILE}\` already exists in this directory.`);
|
29
|
-
|
30
|
+
check = (await consola.prompt("Do you want to reset `coffee.config.js`?", {
|
31
|
+
type: "confirm"
|
32
|
+
}));
|
33
|
+
if (check !== true) {
|
34
|
+
return;
|
35
|
+
}
|
30
36
|
}
|
31
37
|
try {
|
32
38
|
TEMPLATE_PATH = path.join(__dirname, '..', 'temp', 'coffee.config.js');
|
33
39
|
CONFIG_TEMPLATE = fs.readFileSync(TEMPLATE_PATH, 'utf-8');
|
34
40
|
fs.writeFileSync(CONFIG_PATH, CONFIG_TEMPLATE);
|
35
|
-
return consola.success(`Successfully created \`${CONFIG_FILE}
|
41
|
+
return consola.success(`Successfully created \`${CONFIG_FILE}\`!`);
|
36
42
|
} catch (error1) {
|
37
43
|
error = error1;
|
38
44
|
consola.error(`Failed to create \`${CONFIG_FILE}\`:`, error);
|
@@ -40,8 +46,8 @@
|
|
40
46
|
}
|
41
47
|
};
|
42
48
|
|
43
|
-
compile = function() {
|
44
|
-
var command, commandParts, compilerProcess, config, error, i, item, itemPath, items, len, milkee, milkeeOptions, options, otherOptionStrings, targetDir;
|
49
|
+
compile = async function() {
|
50
|
+
var command, commandParts, compilerProcess, config, error, i, item, itemPath, items, len, milkee, milkeeOptions, options, otherOptionStrings, targetDir, toContinue;
|
45
51
|
if (!fs.existsSync(CONFIG_PATH)) {
|
46
52
|
consola.error(`\`${CONFIG_FILE}\` not found in this directory: ${CWD}`);
|
47
53
|
consola.info('Please run `milkee --setup` to create a configuration file.');
|
@@ -70,6 +76,8 @@
|
|
70
76
|
if (!fs.existsSync(targetDir)) {
|
71
77
|
consola.info("Refresh skipped.");
|
72
78
|
} else {
|
79
|
+
consola.info("Executing: Refresh");
|
80
|
+
// Refresh
|
73
81
|
items = fs.readdirSync(targetDir);
|
74
82
|
for (i = 0, len = items.length; i < len; i++) {
|
75
83
|
item = items[i];
|
@@ -84,23 +92,30 @@
|
|
84
92
|
}
|
85
93
|
if (options.bare) {
|
86
94
|
otherOptionStrings.push("--bare");
|
95
|
+
consola.info("Option `bare` is selected.");
|
87
96
|
}
|
88
97
|
if (options.map) {
|
89
98
|
otherOptionStrings.push('--map');
|
99
|
+
consola.info("Option `map` is selected.");
|
90
100
|
}
|
91
101
|
if (options.inlineMap) {
|
92
102
|
otherOptionStrings.push('--inline-map');
|
103
|
+
consola.info("Option `inline-map` is selected.");
|
93
104
|
}
|
94
105
|
if (options.noHeader) {
|
95
106
|
otherOptionStrings.push('--no-header');
|
107
|
+
consola.info("Option `no-header` is selected.");
|
96
108
|
}
|
97
109
|
if (options.transpile) {
|
98
110
|
otherOptionStrings.push('--transpile');
|
111
|
+
consola.info("Option `transpile` is selected.");
|
99
112
|
}
|
100
113
|
if (options.literate) {
|
101
114
|
otherOptionStrings.push('--literate');
|
115
|
+
consola.info("Option `literate` is selected.");
|
102
116
|
}
|
103
117
|
if (options.watch) {
|
118
|
+
consola.info("Option `watch` is selected.");
|
104
119
|
otherOptionStrings.push('--watch');
|
105
120
|
}
|
106
121
|
if (otherOptionStrings.length > 0) {
|
@@ -109,6 +124,12 @@
|
|
109
124
|
commandParts.push('--compile');
|
110
125
|
commandParts.push(`\"${config.entry}\"`);
|
111
126
|
command = commandParts.filter(Boolean).join(' ');
|
127
|
+
if (milkeeOptions.confirm) {
|
128
|
+
toContinue = (await consola.prompt("Do you want to continue?"));
|
129
|
+
if (toContinue !== true) {
|
130
|
+
return;
|
131
|
+
}
|
132
|
+
}
|
112
133
|
if (options.watch) {
|
113
134
|
consola.start(`Watching for changes in \`${config.entry}\`...`);
|
114
135
|
} else {
|
package/package.json
CHANGED
package/temp/coffee.config.js
CHANGED
@@ -1,47 +0,0 @@
|
|
1
|
-
name: Manual Publish to npm
|
2
|
-
|
3
|
-
on:
|
4
|
-
workflow_dispatch:
|
5
|
-
|
6
|
-
jobs:
|
7
|
-
publish-npm:
|
8
|
-
runs-on: ubuntu-latest
|
9
|
-
permissions:
|
10
|
-
id-token: write
|
11
|
-
contents: write
|
12
|
-
steps:
|
13
|
-
- name: Checkout repository
|
14
|
-
uses: actions/checkout@v4
|
15
|
-
|
16
|
-
- name: Setup Node.js
|
17
|
-
uses: actions/setup-node@v4
|
18
|
-
with:
|
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
|
38
|
-
run: npm publish --provenance --access public
|
39
|
-
env:
|
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"
|