@transitive-sdk/utils-caps 0.2.1 → 0.2.3
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/docker.sh +1 -1
- package/esbuild.js +29 -16
- package/package.json +1 -1
- package/publish.sh +1 -1
- package/subScript +3 -0
package/docker.sh
CHANGED
|
@@ -31,7 +31,7 @@ MAX_PORT=$((30080 + $OFFSET * 100))
|
|
|
31
31
|
echo "using port offset $OFFSET, i.e., port $PORT and port range $MIN_PORT-$MAX_PORT"
|
|
32
32
|
|
|
33
33
|
CAP_NAME=$(npm pkg get name)
|
|
34
|
-
VERSION=$(
|
|
34
|
+
VERSION=$(node -e "console.log(require('@transitive-sdk/utils').getPackageVersionNamespace())")
|
|
35
35
|
FULL_NAME=${CAP_NAME/\//.}.${VERSION}
|
|
36
36
|
FULL_NAME2=${FULL_NAME//\"/}
|
|
37
37
|
CONTAINER_NAME=${FULL_NAME2//@/}
|
package/esbuild.js
CHANGED
|
@@ -45,24 +45,37 @@ const config = {
|
|
|
45
45
|
// '.css': 'local-css',
|
|
46
46
|
},
|
|
47
47
|
plugins: [{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
build
|
|
51
|
-
|
|
52
|
-
`
|
|
48
|
+
/* Plugin to run tailwind and @scope the result */
|
|
49
|
+
name: 'tailwind-and-postprocess',
|
|
50
|
+
setup(build) {
|
|
51
|
+
build.onStart(() => {
|
|
52
|
+
execSync(`if (npm ls tailwindcss); then npx tailwindcss -o /tmp/tmp.css &&
|
|
53
|
+
(echo "@scope {"; cat /tmp/tmp.css; echo "}") > web/local.css; fi`);
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
name: 'rebuild-notify',
|
|
58
|
+
setup(build) {
|
|
59
|
+
build.onEnd(result => {
|
|
60
|
+
if (result.errors.length == 0) {
|
|
61
|
+
log.info(build.initialOptions.format, `build ended without errors`);
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
const dir = `/tmp/caps/${process.env.npm_package_name}`;
|
|
64
|
+
isDevelopment &&
|
|
65
|
+
execSync(`mkdir -p ${dir} && cp -r package.json dist ${dir}`);
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
const metaName = [process.env.npm_package_name.replace(/\//, '-'),
|
|
68
|
+
isDevelopment ? 'dev' : 'prod'
|
|
69
|
+
].join('.');
|
|
70
|
+
fs.writeFileSync(`/tmp/${metaName}.meta.json`,
|
|
71
|
+
JSON.stringify(result.metafile));
|
|
72
|
+
} else {
|
|
73
|
+
log.warn(build.initialOptions.format,
|
|
74
|
+
`build ended with ${result.errors.length} errors`);
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
},
|
|
78
|
+
}],
|
|
66
79
|
};
|
|
67
80
|
|
|
68
81
|
|
package/package.json
CHANGED
package/publish.sh
CHANGED
|
@@ -52,7 +52,7 @@ npm run prepare
|
|
|
52
52
|
|
|
53
53
|
npm install --no-save javascript-obfuscator@4.0.0
|
|
54
54
|
|
|
55
|
-
FILES=$(find . -name "*.js" -not -path "**/hi-perf/*" -not -path "**/node_modules/*" -not -path "./dist/*")
|
|
55
|
+
FILES=$(find . -name "*.js" -not -path "**/hi-perf/*" -not -path "**/node_modules/*" -not -path "./dist/*" -not -path "**/var/*")
|
|
56
56
|
for f in $FILES; do
|
|
57
57
|
npx javascript-obfuscator --split-strings true --split-strings-chunk-length 8 --string-array-encoding base64 --ignore-imports true --output $f $f
|
|
58
58
|
# Maybe add later: --self-defending true
|
package/subScript
CHANGED