tungsten 0.2.23 → 0.2.24
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/Framework.js +5 -5
- package/dist/bin/commands/compile.js +8 -8
- package/dist/build/compileStyles.js +2 -1
- package/dist/build/createClientFiles.d.ts.map +1 -1
- package/dist/build/createClientFiles.js +5 -4
- package/dist/build/processPackage.d.ts.map +1 -1
- package/dist/build/processPackage.js +3 -3
- package/dist/removeRecursive.d.ts +2 -0
- package/dist/removeRecursive.d.ts.map +1 -0
- package/dist/removeRecursive.js +12 -0
- package/package.json +1 -2
package/dist/Framework.js
CHANGED
|
@@ -2,8 +2,8 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
//import slash from 'slash'
|
|
5
|
-
import rmfr from 'rmfr';
|
|
6
5
|
import { join } from 'path';
|
|
6
|
+
import { removeRecursive } from "./removeRecursive.js";
|
|
7
7
|
import { filter as objectFilter, remap as objectRemap } from 'sxy-lib/objects.js';
|
|
8
8
|
import { buildCodeSubPath, buildFolder, devBuildOuterFolder, prodBuildFolder, prodBuildCodeFolder, bundleFolder, staticSiteFolder } from "./settings.js";
|
|
9
9
|
import { DevServer } from "./Servers/DevServer.js";
|
|
@@ -65,22 +65,22 @@ export class Framework {
|
|
|
65
65
|
switch (mode) {
|
|
66
66
|
case 'prod':
|
|
67
67
|
{
|
|
68
|
-
await Promise.all([
|
|
68
|
+
await Promise.all([removeRecursive(join(projectDir, prodBuildFolder)), removeRecursive(join(projectDir, bundleFolder))]);
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
71
|
case 'staticSite':
|
|
72
72
|
{
|
|
73
|
-
await
|
|
73
|
+
await removeRecursive(join(projectDir, staticSiteFolder));
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
76
|
case 'dev':
|
|
77
77
|
{
|
|
78
|
-
await
|
|
78
|
+
await removeRecursive(join(projectDir, devBuildOuterFolder));
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
81
|
default:
|
|
82
82
|
{
|
|
83
|
-
await
|
|
83
|
+
await removeRecursive(join(projectDir, buildFolder));
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dirname, join, resolve } from 'path';
|
|
2
2
|
import { promises as fsPromises } from 'fs';
|
|
3
|
-
import
|
|
3
|
+
import { removeRecursive } from "../../removeRecursive.js";
|
|
4
4
|
import { compileJavascript } from "../../build/compileJavascript.js";
|
|
5
5
|
import { compileStyles } from "../../build/compileStyles.js";
|
|
6
6
|
import { copyAssets } from "../../build/copyAssets.js";
|
|
@@ -101,7 +101,7 @@ if (buildLocation.toLowerCase() === resolve(projectDir).toLowerCase()) {
|
|
|
101
101
|
process.exit(1);
|
|
102
102
|
}
|
|
103
103
|
async function clearReadyFile() {
|
|
104
|
-
if (readyFileLocation !== undefined) await
|
|
104
|
+
if (readyFileLocation !== undefined) await removeRecursive(readyFileLocation);
|
|
105
105
|
}
|
|
106
106
|
async function markReady() {
|
|
107
107
|
if (readyFileLocation === undefined) return;
|
|
@@ -115,23 +115,23 @@ async function markReady() {
|
|
|
115
115
|
targets: [...targets],
|
|
116
116
|
updatedAt: new Date().toISOString()
|
|
117
117
|
}));
|
|
118
|
-
await
|
|
118
|
+
await removeRecursive(readyFileLocation);
|
|
119
119
|
await fsPromises.rename(temporaryLocation, readyFileLocation);
|
|
120
120
|
}
|
|
121
121
|
await clearReadyFile();
|
|
122
122
|
const cleanTasks = [];
|
|
123
123
|
if (clean && targets.has('js')) {
|
|
124
|
-
cleanTasks.push(
|
|
124
|
+
cleanTasks.push(removeRecursive(buildCodeLocation), removeRecursive(join(buildLocation, componentCssFolder)), removeRecursive(join(buildLocation, packagesFolder)), removeRecursive(packagesCacheLocation));
|
|
125
125
|
}
|
|
126
126
|
if (clean && targets.has('css')) {
|
|
127
|
-
cleanTasks.push(
|
|
127
|
+
cleanTasks.push(removeRecursive(join(buildLocation, staticFolder)));
|
|
128
128
|
}
|
|
129
129
|
if (clean && targets.has('client')) {
|
|
130
|
-
cleanTasks.push(
|
|
130
|
+
cleanTasks.push(removeRecursive(join(buildLocation, clientFolder)), removeRecursive(join(buildLocation, '.tungsten.config.js')));
|
|
131
131
|
}
|
|
132
132
|
if (clean) {
|
|
133
|
-
if (targets.has('assets')) cleanTasks.push(
|
|
134
|
-
if (targets.has('public')) cleanTasks.push(
|
|
133
|
+
if (targets.has('assets')) cleanTasks.push(removeRecursive(join(buildLocation, assetsFolder)));
|
|
134
|
+
if (targets.has('public')) cleanTasks.push(removeRecursive(join(buildLocation, publicFolder)));
|
|
135
135
|
cliOut(`Cleaning compile output: ${[...targets].join(', ')}`);
|
|
136
136
|
await Promise.all(cleanTasks);
|
|
137
137
|
}
|
|
@@ -209,7 +209,8 @@ export async function compileStyles(projectDir, config, styleImportBase, buildLo
|
|
|
209
209
|
// C is needed by B,A
|
|
210
210
|
// D is needed by C,B,A
|
|
211
211
|
const cssFiles = {};
|
|
212
|
-
const sourceLocation = config.sourceDir
|
|
212
|
+
const sourceLocation = config.sourceDir // eslint-disable-line @typescript-eslint/strict-boolean-expressions
|
|
213
|
+
? join(projectDir, config.sourceDir) : join(projectDir, config.codeDir);
|
|
213
214
|
const staticLocation = join(buildLocation, staticFolder);
|
|
214
215
|
const watchGlob = sourceLocation + '/**/*.{css,scss,sass,less}';
|
|
215
216
|
const ignoreGlob = buildLocation + '/**/*';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClientFiles.d.ts","sourceRoot":"","sources":["../../src/build/createClientFiles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAOtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAG/D,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,uBAAuB,EAC/B,IAAI,EAAE,IAAI,EACV,aAAa,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createClientFiles.d.ts","sourceRoot":"","sources":["../../src/build/createClientFiles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAOtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAG/D,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,uBAAuB,EAC/B,IAAI,EAAE,IAAI,EACV,aAAa,CAAC,EAAE,MAAM,iBAiFzB"}
|
|
@@ -11,11 +11,12 @@ export async function createClientFiles(config, mode, buildLocation) {
|
|
|
11
11
|
const routesLocation = config.routesLocation;
|
|
12
12
|
//if (routesLocation !== null) {
|
|
13
13
|
const [routeFilePath, routesExportName] = routesLocation;
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
fsPromises.mkdir(join(specificBuildFolder, `${clientFolder}`), {
|
|
14
|
+
// ensure the folder exists -- must complete before anything below writes into it,
|
|
15
|
+
// so it can't just be another entry in the promises array (they all start eagerly)
|
|
16
|
+
await fsPromises.mkdir(join(specificBuildFolder, `${clientFolder}`), {
|
|
17
17
|
recursive: true
|
|
18
|
-
})
|
|
18
|
+
});
|
|
19
|
+
const promises = [
|
|
19
20
|
// client.js file
|
|
20
21
|
fsPromises.copyFile(join(frameworkDir, frameworkDistFolder, frameworkClientFolder, 'client.js'),
|
|
21
22
|
// from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processPackage.d.ts","sourceRoot":"","sources":["../../src/build/processPackage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processPackage.d.ts","sourceRoot":"","sources":["../../src/build/processPackage.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG/D,OAAO,EAAE,oBAAoB,EAA4D,MAAM,2BAA2B,CAAA;AAwB1H,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAoGxK"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import rmfr from 'rmfr';
|
|
2
1
|
import { transform } from 'cjstoesm';
|
|
3
2
|
import { promises as fsPromises } from 'fs';
|
|
4
3
|
import fsExtra from 'fs-extra';
|
|
5
4
|
import { packagesCacheFolder, packagesFolder } from "../settings.js";
|
|
5
|
+
import { removeRecursive } from "../removeRecursive.js";
|
|
6
6
|
import { cliLog } from "../cliOutput.js";
|
|
7
7
|
//import { getFrameworkDir } from '../getFrameworkDir.js'
|
|
8
8
|
//// Don't think we are using this
|
|
@@ -43,7 +43,7 @@ export async function processPackage(projectDir, packagesCacheInfo, packageName,
|
|
|
43
43
|
console.log(`Didn't find ${packageAndVersion} in packages cached - proceeding`);
|
|
44
44
|
//
|
|
45
45
|
// check if package is esm or cjs?
|
|
46
|
-
|
|
46
|
+
await removeRecursive(targetLocation);
|
|
47
47
|
await fsPromises.mkdir(targetLocation);
|
|
48
48
|
//console.log('json for ', packageName, json)
|
|
49
49
|
if (packageJson.type === undefined && packageJson.type !== 'module') {
|
|
@@ -52,7 +52,7 @@ export async function processPackage(projectDir, packagesCacheInfo, packageName,
|
|
|
52
52
|
const input = `${sourceLocation}/**/*`;
|
|
53
53
|
/// change to cache loc
|
|
54
54
|
//const outDir = targetLocation
|
|
55
|
-
|
|
55
|
+
await removeRecursive(cacheLocation);
|
|
56
56
|
await fsPromises.mkdir(cacheLocation);
|
|
57
57
|
await transform({
|
|
58
58
|
input: input,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeRecursive.d.ts","sourceRoot":"","sources":["../src/removeRecursive.ts"],"names":[],"mappings":"AAOA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { promises as fsPromises } from 'fs';
|
|
2
|
+
// replaces the old rmfr dependency - node has covered this natively since 14.14
|
|
3
|
+
// force: resolve quietly when the path is already gone, matching rm -rf
|
|
4
|
+
// maxRetries: windows often holds handles on build output for a moment after a
|
|
5
|
+
// watcher or child process lets go, which surfaces as EBUSY/EPERM
|
|
6
|
+
export function removeRecursive(path) {
|
|
7
|
+
return fsPromises.rm(path, {
|
|
8
|
+
recursive: true,
|
|
9
|
+
force: true,
|
|
10
|
+
maxRetries: 3
|
|
11
|
+
});
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tungsten",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -98,7 +98,6 @@
|
|
|
98
98
|
"@types/prop-types": "^15.7.15",
|
|
99
99
|
"@types/react": "19.1.9",
|
|
100
100
|
"@types/react-dom": "19.1.7",
|
|
101
|
-
"@types/rmfr": "^2.0.5",
|
|
102
101
|
"@types/serialize-javascript": "^5.0.4",
|
|
103
102
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
104
103
|
"@typescript-eslint/parser": "^5.62.0",
|