@dotpi/tools 2.10.2 → 2.11.0

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.
@@ -190,35 +190,37 @@ while ! N_PREFIX="$N_PREFIX" bash /tmp/n-install -y -a "$node_arch" "$dotpi_node
190
190
  sudo mkdir -p -- "$N_PREFIX"
191
191
  done
192
192
 
193
-
194
193
  rm -f /tmp/n-install
195
194
 
196
195
 
197
-
198
- # echo "
199
- # # dotpi: force the usage of -a for correct architecture
200
- # # (n relies on uname, which tells about the kernel, not the executables)
201
-
202
- # alias n='${environment_variables[*]} n -a ${node_arch}'
203
- # " >> "${HOME}/.bashrc" || {
204
- # error_exit $? "n alias in /root/.bashrc" $error_exit_code_node
205
- # }
206
-
207
196
  source_path="${N_PREFIX}/bin"
208
197
  destination_path="/usr/bin"
209
- executables=(
210
- corepack
211
- n
212
- node
213
- npm
214
- npx
198
+
199
+ n_path_to_symlinks() (
200
+ cd "${N_PREFIX}/bin" || {
201
+ error_exit $? "cd ${N_PREFIX}/bin" $error_exit_code_node
202
+ }
203
+
204
+ for executable in * ; do
205
+ sudo ln -s -f "${source_path}/${executable}" "${destination_path}/${executable}" || {
206
+ error_exit $? "symlink to ${destination_path}/${executable}" $error_exit_code_node
207
+ }
208
+ done
215
209
  )
216
- for executable in "${executables[@]}" ; do
217
- sudo ln -s -f "${source_path}/${executable}" "${destination_path}/${executable}" || {
218
- error_exit $? "symlink to ${destination_path}/${executable}" $error_exit_code_node
219
- }
210
+
211
+ # bootstrap: node, npm
212
+ n_path_to_symlinks
213
+
214
+ # pnpm is mandatory for node modules
215
+ for package in "${dotpi_node_install_default[@]}" "${dotpi_node_install[@]}" ; do
216
+ npm -g install "$package" || {
217
+ error_exit $? "npm install ${package}" $error_exit_code_node
218
+ }
220
219
  done
221
220
 
221
+ # update: pnpm
222
+ n_path_to_symlinks
223
+
222
224
  ############## services and modules
223
225
  error_exit_code_services=4
224
226
 
@@ -230,46 +232,46 @@ sudo loginctl enable-linger "$FIRSTUSER" || {
230
232
 
231
233
  ############# dotpi module manager
232
234
 
233
- # bootstrap-install
234
- module_name="@dotpi/module-module"
235
- source_path="${DOTPI_ROOT}/dist/${module_name}"
236
- destination_prefix="${DOTPI_ROOT}/lib"
237
- destination_path="${destination_prefix}/node_modules/${module_name}"
238
- {
239
- dotpi echo_info "Install ${module_name}"
240
- # minimal install in the modules directory
241
- sudo npm install --no-fund \
242
- --prefix "$destination_prefix" \
243
- --install-strategy nested \
244
- --omit dev \
245
- --save \
246
- --ignore-scripts \
247
- -- \
248
- "$source_path" || {
249
- error_exit $? "dotpi_module: error when installing '${module_name}'" $error_exit_code_services
250
- }
251
-
252
- (
253
- echo "# Install '${module_name}' dependencies"
254
- # complete install within the module itself
255
- # be sure to install links for relative dependencies also
256
- # run postinstall script
257
-
258
- sudo rm -rf "${destination_path}/node_modules" || {
259
- error_exit $? "rm ${destination_path}/node_modules" $error_exit_code_services
260
- }
261
-
262
- sudo npm install --no-fund \
263
- --prefix "$destination_path" \
264
- --omit dev \
265
- --install-links \
266
- || {
267
- error_exit $? "dotpi_module: error when installing '${module_name}' dependencies'" $error_exit_code_services
268
- }
269
- )
270
- } || {
271
- error_exit $? "${module_name}" $error_exit_code_services
272
- }
235
+ # # bootstrap-install
236
+ # module_name="@dotpi/module-module"
237
+ # source_path="${DOTPI_ROOT}/dist/${module_name}"
238
+ # destination_prefix="${DOTPI_ROOT}/lib"
239
+ # destination_path="${destination_prefix}/node_modules/${module_name}"
240
+ # {
241
+ # dotpi echo_info "Install ${module_name}"
242
+ # # minimal install in the modules directory
243
+ # sudo npm install --no-fund \
244
+ # --prefix "$destination_prefix" \
245
+ # --install-strategy nested \
246
+ # --omit dev \
247
+ # --save \
248
+ # --ignore-scripts \
249
+ # -- \
250
+ # "$source_path" || {
251
+ # error_exit $? "dotpi_module: error when installing '${module_name}'" $error_exit_code_services
252
+ # }
253
+
254
+ # (
255
+ # echo "# Install '${module_name}' dependencies"
256
+ # # complete install within the module itself
257
+ # # be sure to install links for relative dependencies also
258
+ # # run postinstall script
259
+
260
+ # sudo rm -rf "${destination_path}/node_modules" || {
261
+ # error_exit $? "rm ${destination_path}/node_modules" $error_exit_code_services
262
+ # }
263
+
264
+ # sudo npm install --no-fund \
265
+ # --prefix "$destination_path" \
266
+ # --omit dev \
267
+ # --install-links \
268
+ # || {
269
+ # error_exit $? "dotpi_module: error when installing '${module_name}' dependencies'" $error_exit_code_services
270
+ # }
271
+ # )
272
+ # } || {
273
+ # error_exit $? "${module_name}" $error_exit_code_services
274
+ # }
273
275
 
274
276
  ############## audio
275
277
  error_exit_code_audio=6
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2023-present IRCAM – Centre Pompidou (France, Paris)
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright notice, this
12
+ list of conditions and the following disclaimer in the documentation and/or
13
+ other materials provided with the distribution.
14
+
15
+ * Neither the name of the IRCAM nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotpi/module",
3
- "version": "1.8.3",
3
+ "version": "1.10.0",
4
4
  "description": "dotpi module management",
5
5
  "type": "module",
6
6
  "exports": {
@@ -11,5 +11,6 @@
11
11
  "@dotpi/javascript": "^1.6.3",
12
12
  "execa": "^9.5.2",
13
13
  "globby": "^14.0.2"
14
- }
14
+ },
15
+ "gitHead": "eda55d63aae1df93a85f0192bfc7305825bfce72"
15
16
  }
@@ -35,17 +35,20 @@ export async function install(modules = [], {
35
35
  switch (verbose) {
36
36
  case '0':
37
37
  case 'false':
38
+ case 'none':
38
39
  case false:
39
40
  verbose = 'none';
40
41
  break;
41
42
 
42
43
  case '1':
43
44
  case 'true':
45
+ case 'short':
44
46
  case true:
45
47
  verbose = 'short';
46
48
  break;
47
49
 
48
50
  case '2':
51
+ case 'full':
49
52
  verbose = 'full';
50
53
  break;
51
54
  }
@@ -78,62 +81,29 @@ export async function install(modules = [], {
78
81
  let cwd;
79
82
 
80
83
  if(verbose === 'full') {
81
- console.log(`Getting '${moduleToInstall}' definition`);
84
+ console.log(`Installing '${moduleToInstall}'`);
82
85
  }
83
- const moduleDefinition = await definitionGet(moduleToInstall);
84
- const { name: moduleName } = moduleDefinition;
85
-
86
- // 2-steps install as npm errors when installing from git
87
- // npm error git dep preparation failed
88
-
89
- if(verbose !== 'none') {
90
- echo.info(`Installing module '${moduleToInstall}' in '${dotpiModulesDestination}'`);
91
- }
92
- cwd = dotpiModulesDestination;
93
- output = await $({
94
- cwd,
95
- env: { FORCE_COLOR: 'true' }, // do not remove colors
96
- verbose: (verbose === 'full' ? 'full' : 'none'),
97
- // minimal install in the modules directory
98
- })`
99
- npm --prefix ${cwd}
100
- install --no-fund
101
- --install-strategy nested
102
- --omit dev
103
- --save
104
- --ignore-scripts
105
- --
106
- ${moduleToInstall}
107
- `;
108
86
 
87
+ // create link first, it may be used in postinstall scripts
109
88
  await symlink(
110
89
  path.join('.', 'node_modules'),
111
90
  path.join(dotpiModulesDestination, 'dotpi_modules')
112
91
  );
113
92
 
114
- if(verbose === 'full') {
115
- echo.info(`Installing ${moduleToInstall} dependencies`)
116
- }
117
- cwd = path.resolve(dotpiModulesDestination, 'node_modules', moduleName);
118
-
119
- // perform a clean install
120
- await fs.rm(path.resolve(cwd, 'node_modules'), {
121
- recursive: true,
122
- force: true,
123
- });
93
+ const moduleDefinition = await definitionGet(moduleToInstall);
94
+ const { name: moduleName } = moduleDefinition;
124
95
 
96
+ cwd = dotpiModulesDestination;
125
97
  output = await $({
126
98
  cwd,
127
99
  env: { FORCE_COLOR: 'true' }, // do not remove colors
128
100
  verbose: (verbose === 'full' ? 'full' : 'none'),
129
- // complete install within the module itself
130
- // be sure to install links for relative dependencies also
131
- // run postinstall script
101
+ // full install with postinstall scripts for each request
132
102
  })`
133
- npm --prefix ${cwd}
134
- install --no-fund
135
- --omit dev
136
- --install-links
103
+ npx pnpm install
104
+ --dangerously-allow-all-builds
105
+ --
106
+ ${moduleToInstall}
137
107
  `;
138
108
 
139
109
  } catch (error) {
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2023-present IRCAM – Centre Pompidou (France, Paris)
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright notice, this
12
+ list of conditions and the following disclaimer in the documentation and/or
13
+ other materials provided with the distribution.
14
+
15
+ * Neither the name of the IRCAM nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotpi/module-module",
3
- "version": "1.8.3",
3
+ "version": "1.10.0",
4
4
  "description": "dotpi module management",
5
5
  "type": "module",
6
6
  "bin": "./bin/dotpi_module",
@@ -11,7 +11,8 @@
11
11
  "license": "BSD-3-clause",
12
12
  "dependencies": {
13
13
  "@dotpi/javascript": "^1.6.3",
14
- "@dotpi/module": "^1.8.3",
14
+ "@dotpi/module": "^1.10.0",
15
15
  "commander": "^12.1.0"
16
- }
16
+ },
17
+ "gitHead": "eda55d63aae1df93a85f0192bfc7305825bfce72"
17
18
  }
@@ -82,3 +82,8 @@ dotpi_module_install_default=(
82
82
  dotpi_module_install=()
83
83
 
84
84
  dotpi_node_version='lts'
85
+ dotpi_node_install_default=(
86
+ 'pnpm' # for @dotpi/module-module
87
+ 'yarn' # convenience
88
+ )
89
+ dotpi_node_install=()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotpi/tools",
3
- "version": "2.10.2",
3
+ "version": "2.11.0",
4
4
  "description": "Set of scripts for managing dotpi fleets of Raspberry Pi",
5
5
  "author": "Jean-Philippe Lambert",
6
6
  "contributors": [
@@ -37,7 +37,7 @@
37
37
  "license": "BSD-3-Clause",
38
38
  "dependencies": {
39
39
  "@dotpi/javascript": "^1.6.3",
40
- "@dotpi/module": "^1.8.3",
40
+ "@dotpi/module": "^1.10.0",
41
41
  "chalk": "^5.3.0",
42
42
  "commander": "^12.1.0",
43
43
  "prompts": "^2.4.2",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "lerna": "^8.2.4"
48
48
  },
49
- "gitHead": "01548da878a4515021a67428b4138b2b4af1c807"
49
+ "gitHead": "eda55d63aae1df93a85f0192bfc7305825bfce72"
50
50
  }