@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 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=$(npm pkg get 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
- name: 'rebuild-notify',
49
- setup(build) {
50
- build.onEnd(result => {
51
- log.info(build.initialOptions.format,
52
- `build ended with ${result.errors.length} errors`);
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
- const dir = `/tmp/caps/${process.env.npm_package_name}`;
55
- isDevelopment &&
56
- execSync(`mkdir -p ${dir} && cp -r package.json dist ${dir}`);
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
- const metaName = [process.env.npm_package_name.replace(/\//, '-'),
59
- isDevelopment ? 'dev' : 'prod'
60
- ].join('.');
61
- fs.writeFileSync(`/tmp/${metaName}.meta.json`,
62
- JSON.stringify(result.metafile));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transitive-sdk/utils-caps",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Utilities to build and run Transitive capabilities in dev",
5
5
  "homepage": "https://transitiverobotics.com",
6
6
  "repository": {
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
@@ -36,6 +36,9 @@ fi;
36
36
 
37
37
  if [[ $SUBSCRIPT == "start" ]]; then
38
38
  # ensure dependencies are installed
39
+ if [[ $SUBPROJECT ]]; then
40
+ rm -rf $SUBPROJECT/node_modules/.*-* $SUBPROJECT/node_modules/@*/.*-*
41
+ fi;
39
42
  npm $PREFIX ls || npm $PREFIX update
40
43
  fi;
41
44