@digigov/cli-app 1.2.3 → 2.0.0-0138f8bd

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/common.js ADDED
@@ -0,0 +1,4 @@
1
+ export const EXEC_CONFIG = {
2
+ extendEnv: false,
3
+ stdio: 'inherit',
4
+ };
@@ -0,0 +1,3 @@
1
+ import config from '@digigov/cli-lint/eslint.config';
2
+
3
+ export default [...config];
package/index.js CHANGED
@@ -1,87 +1,22 @@
1
- const { flags } = require('@oclif/command')
2
- const execa = require('execa')
3
- const fs = require('fs')
4
- const { resolveProject, makeConfig, DigigovCommand } = require('@digigov/cli/lib')
5
- const path = require('path');
6
- const yargs = require('yargs');
7
- const execConfig = { env: {}, stdio: 'inherit' }
8
- const generatePagesTestFile = require('./lib/test/init.js')
9
- module.exports = class App extends DigigovCommand {
10
- static description = 'app digigov projects'
11
- static id = 'app'
12
- static examples = [
13
- `$ digigov app`,
14
- ]
15
- dirname = __dirname
16
- static load() { return App }
17
- script = 'next'
18
- async run() {
19
- const [command, ...args] = this.argv;
20
- let proc;
21
- const project = resolveProject();
22
- switch (command) {
23
- case 'export':
24
- await this.exec('rimraf', ['out'])
25
- await this.exec(this.script, ['build'])
26
- proc = this.exec(this.script, [command, ...args], execConfig)
27
- break;
28
- case 'build':
29
- await this.exec('rimraf', ['out'])
30
- proc = this.exec(this.script, [command, ...args], execConfig)
31
- break;
32
- case 'start':
33
- if (!fs.existsSync(path.join(project.root, '.next'))) {
34
- await this.exec(this.script, ['build']);
35
- }
36
- proc = this.exec(this.script, [command, ...args], execConfig);
37
- break;
38
- case 'dev':
39
- const digigov = project.digigov;
40
- if (digigov && digigov.proxy) {
41
- await execa('node', [path.resolve(__dirname, 'proxy-server.js')], execConfig);
42
- }
43
- proc = this.exec(this.script, [command, ...args], execConfig);
44
- break;
45
- case 'test':
46
- const test_args = yargs
47
- .option('init', {
48
- alias: 'i',
49
- describe: 'Initialize project with specified parameters'
50
- })
51
- .option('baseUrl', {
52
- alias: 'b',
53
- describe: 'The base url of the running project',
54
- default: 'http://localhost:3000'
55
- })
56
- .option('pagesPath', {
57
- alias: 'p',
58
- describe: 'The directory where the pages are located relative to the project folder',
59
- default: 'pages'
60
- })
61
- .option('screenSizes', {
62
- alias: 's',
63
- choices: ['xs', 'lg'],
64
- describe: 'The screen sizes for viewport',
65
- })
66
- .help()
67
- .argv;
1
+ import { DigigovCommand, logger } from '@digigov/cli/lib';
68
2
 
69
- if (test_args.init) {
70
- const { baseUrl, pagesPath, screenSizes } = test_args;
71
- console.log(`Generating test files for pagesPath "${pagesPath}" with baseUrl "${baseUrl}" for screen sizes "${screenSizes}"`);
72
- const projectFolder = process.cwd();
73
- generatePagesTestFile(projectFolder, pagesPath, baseUrl, screenSizes);
74
- } else {
75
- console.log('Usage: digigov app test --init --baseUrl [baseUrl] --pagesPath [pagesPath] --screenSizes [screenSizes]');
76
- console.log('baseUrl: the base url of the running project (default: http://localhost:3000)');
77
- console.log('pagesPath: the directory where the pages are located (default: pages, src/pages)');
78
- console.log('screenSizes: the screen sizes for viewport (default: lg)');
79
- }
80
- break;
81
- default:
82
- console.error(`No command with name ${command}`)
83
- }
84
- return proc;
85
- }
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import fs from 'fs';
6
+
7
+ const command = new DigigovCommand('app', import.meta.url);
8
+
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+ const subcommandsDir = path.join(__dirname, 'subcommands');
11
+
12
+ const subcommands = fs.readdirSync(subcommandsDir);
13
+ for (const subcommand of subcommands) {
14
+ const subcommandPath = path.join(subcommandsDir, subcommand);
15
+ const subcommandModule = await import(subcommandPath);
16
+ command.addCommand(subcommandModule.default);
17
+ logger.debug(
18
+ `Loaded subcommand for cli-app: ${subcommand.replace('.js', '')}`
19
+ );
86
20
  }
87
21
 
22
+ export default command;
@@ -1,8 +1,6 @@
1
- const path = require('path');
2
1
  const lib = require('@digigov/cli/lib');
3
- let aliases = lib.aliases(null, true);
2
+ let aliases = lib.aliases(true);
4
3
  const withImages = require('next-images');
5
- const { makeBabelConfig } = require('@digigov/cli-build/babel.common');
6
4
 
7
5
  function makeNextConfig(dir) {
8
6
  const project = lib.resolveProject(dir);
@@ -0,0 +1 @@
1
+ module.exports = require('./next.common.cjs').config;
package/nextrc.cjs ADDED
@@ -0,0 +1,5 @@
1
+ const { makeConfig } = require('@digigov/cli/lib');
2
+
3
+ module.exports = (overrides) => {
4
+ return makeConfig(overrides, require('./next.common.cjs').config);
5
+ };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@digigov/cli-app",
3
- "version": "1.2.3",
3
+ "version": "2.0.0-0138f8bd",
4
4
  "description": "@digigov developer cli tool",
5
- "main": "index.js",
5
+ "main": "./index.js",
6
+ "type": "module",
6
7
  "author": "GRNET Developers <devs@lists.grnet.gr>",
7
8
  "license": "BSD-2-Clause",
8
9
  "dependencies": {
@@ -10,27 +11,46 @@
10
11
  "express": "4.17.1",
11
12
  "http-proxy-middleware": "1.0.3",
12
13
  "next-images": "1.3.0",
13
- "@digigov/cli-build": "1.1.1",
14
+ "@digigov/cli-build": "2.0.0-0138f8bd",
14
15
  "url-loader": "4.1.1",
15
16
  "next": "13.1.1",
16
- "publint": "0.1.8",
17
- "yargs": "17.7.2",
18
- "@oclif/command": "1.8.0",
19
- "glob": "7.1.6"
17
+ "commander": "12.1.0",
18
+ "globby": "11.0.0",
19
+ "publint": "0.1.8"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "rimraf": "3.0.2",
23
- "execa": "5.0.0",
24
- "@digigov/cli": "1.1.0",
25
- "typescript": "5.3.2",
26
- "@types/node": "18.19.0",
27
- "@types/react": "18.3.3",
23
+ "@digigov/cli": "2.0.0-0138f8bd",
24
+ "typescript": "5.6.2",
25
+ "@types/node": "20.17.24",
26
+ "@types/react": "19.1.3",
28
27
  "autoprefixer": "10.4.16",
29
28
  "postcss": "8.4.4",
30
- "@digigov/css": "1.2.0",
31
- "tailwindcss": "3.3.5"
29
+ "@digigov/css": "2.0.0-0138f8bd",
30
+ "tailwindcss": "3.4.13"
31
+ },
32
+ "exports": {
33
+ ".": "./index.js",
34
+ "./next.common": "./next.common.cjs",
35
+ "./next.config": "./next.config.cjs",
36
+ "./nextrc": "./nextrc.cjs",
37
+ "./postcss.config": "./postcss.config.cjs",
38
+ "./postcss.common": "./postcss.common.cjs",
39
+ "./postcssrc": "./postcssrc.cjs",
40
+ "./tailwind.config": "./tailwind.config.cjs",
41
+ "./tailwind.common": "./tailwind.common.cjs",
42
+ "./tailwindrc": "./tailwindrc.cjs"
43
+ },
44
+ "devDependencies": {
45
+ "typescript": "5.6.2",
46
+ "@digigov/cli": "2.0.0-0138f8bd",
47
+ "@digigov/cli-lint": "2.0.0-0138f8bd",
48
+ "eslint": "9.16.0",
49
+ "prettier": "3.4.2"
32
50
  },
33
51
  "scripts": {
34
- "publint": "publint"
52
+ "publint": "publint",
53
+ "lint": "digigov lint",
54
+ "typecheck": "tsc"
35
55
  }
36
- }
56
+ }
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  plugins: {
3
- "tailwindcss/nesting": {},
3
+ 'tailwindcss/nesting': {},
4
4
  tailwindcss: {},
5
5
  autoprefixer: {},
6
6
  },
@@ -0,0 +1 @@
1
+ module.exports = require('./postcss.common.cjs').config;
package/postcssrc.cjs ADDED
@@ -0,0 +1,5 @@
1
+ const { makeConfig } = require('@digigov/cli/lib');
2
+
3
+ module.exports = (overrides) => {
4
+ return makeConfig(overrides, require('./postcss.common.cjs'));
5
+ };
@@ -0,0 +1,15 @@
1
+ import { DigigovCommand } from '@digigov/cli/lib';
2
+ import { EXEC_CONFIG } from '../common.js';
3
+
4
+ const buildCommand = new DigigovCommand('build');
5
+
6
+ buildCommand
7
+ .argument('[...args]', 'Arguments to pass to the `next build` command')
8
+ .helpOption(false)
9
+ .allowUnknownOption()
10
+ .action(async (args = [], _, ctx) => {
11
+ await ctx.exec('rimraf', ['out']);
12
+ await ctx.exec('next', ['build', ...args], EXEC_CONFIG);
13
+ });
14
+
15
+ export default buildCommand;
@@ -0,0 +1,28 @@
1
+ import { DigigovCommand, resolveProject, logger } from '@digigov/cli/lib';
2
+ import { EXEC_CONFIG } from '../common.js';
3
+
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
6
+
7
+ const { digigov } = resolveProject();
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
+
10
+ const devCommand = new DigigovCommand('dev');
11
+
12
+ devCommand
13
+ .argument('[...args]', 'Arguments to pass to the `next dev` command')
14
+ .helpOption(false)
15
+ .allowUnknownOption()
16
+ .action(async (args = [], _, ctx) => {
17
+ logger.info('Starting development server...');
18
+ if (digigov && digigov.proxy) {
19
+ await ctx.exec(
20
+ 'node',
21
+ [path.resolve(__dirname, '../utils/proxy-server.js')],
22
+ EXEC_CONFIG
23
+ );
24
+ }
25
+ await ctx.exec('next', ['dev', ...(args ?? [])], EXEC_CONFIG);
26
+ });
27
+
28
+ export default devCommand;
@@ -0,0 +1,16 @@
1
+ import { DigigovCommand } from '@digigov/cli/lib';
2
+ import { EXEC_CONFIG } from '../common.js';
3
+
4
+ const exportCommand = new DigigovCommand('export');
5
+
6
+ exportCommand
7
+ .argument('[...args]', 'Arguments to pass to the `next export` command')
8
+ .helpOption(false)
9
+ .allowUnknownOption()
10
+ .action(async (args = [], _, ctx) => {
11
+ await ctx.exec('rimraf', ['out']);
12
+ await ctx.exec('next', ['build']);
13
+ await ctx.exec('next', ['export', ...args], EXEC_CONFIG);
14
+ });
15
+
16
+ export default exportCommand;
@@ -0,0 +1,22 @@
1
+ import fs from 'fs';
2
+
3
+ import { DigigovCommand, resolveProject } from '@digigov/cli/lib';
4
+ import { EXEC_CONFIG } from '../common.js';
5
+ import path from 'path';
6
+
7
+ const startCommand = new DigigovCommand('start');
8
+
9
+ const project = resolveProject();
10
+
11
+ startCommand
12
+ .argument('[...args]', 'Arguments to pass to the `next start` command')
13
+ .helpOption(false)
14
+ .allowUnknownOption()
15
+ .action(async (args = [], _, ctx) => {
16
+ if (!fs.existsSync(path.join(project.root, '.next'))) {
17
+ await ctx.exec('next', ['build']);
18
+ }
19
+ await ctx.exec('next', ['start', ...args], EXEC_CONFIG);
20
+ });
21
+
22
+ export default startCommand;
@@ -0,0 +1,34 @@
1
+ import { Option } from 'commander';
2
+
3
+ import { logger, DigigovCommand } from '@digigov/cli/lib';
4
+ import generatePagesTestFile from '../utils/test-init.js';
5
+
6
+ const testCommand = new DigigovCommand('test');
7
+
8
+ testCommand
9
+ .description('Initialize project with specified parameters')
10
+ .option(
11
+ '-b, --base-url',
12
+ 'The base url of the running project',
13
+ 'http://localhost:3000'
14
+ )
15
+ .option(
16
+ '-p, --pages-path',
17
+ 'The directory where the pages are located relative to the project folder',
18
+ 'pages'
19
+ )
20
+ .addOption(
21
+ new Option('-s, --screen-sizes', 'The screen sizes for viewport')
22
+ .choices(['xs', 'lg'])
23
+ .default('lg')
24
+ )
25
+ .action(async (options) => {
26
+ const { baseUrl, pagesPath, screenSizes } = options;
27
+ logger.log(
28
+ `Generating test files for pagesPath "${pagesPath}" with baseUrl "${baseUrl}" for screen sizes "${screenSizes}"`
29
+ );
30
+ const projectFolder = process.cwd();
31
+ generatePagesTestFile(projectFolder, pagesPath, baseUrl, screenSizes);
32
+ });
33
+
34
+ export default testCommand;
@@ -0,0 +1,11 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: {
4
+ files: [
5
+ './src/**/*.{js,ts,jsx,tsx}',
6
+ './node_modules/@digigov/react-core/**/*.{js,ts,jsx,tsx}',
7
+ ],
8
+ relative: true,
9
+ },
10
+ plugins: [require('@digigov/css')],
11
+ };
@@ -0,0 +1 @@
1
+ module.exports = require('./tailwind.common.cjs').config;
package/tailwindrc.cjs ADDED
@@ -0,0 +1,5 @@
1
+ const { makeConfig } = require('@digigov/cli/lib');
2
+
3
+ module.exports = (overrides) => {
4
+ return makeConfig(overrides, require('./tailwind.common.cjs'));
5
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "@digigov/cli/tsconfig.cli",
3
+ "include": ["./*.js", "./subcommands", "./utils"],
4
+ "exclude": ["eslint.config.js", ".prettierrc.cjs"]
5
+ }
@@ -1,40 +1,35 @@
1
- /* eslint-disable no-console */
2
- const express = require('express');
3
- const next = require('next');
4
- const { resolveProject, extractCommandArgs } = require('@digigov/cli/lib');
1
+ import express from 'express';
2
+ import next from 'next';
3
+ import path from 'path';
4
+ import { createRequire } from 'module';
5
+
6
+ import { resolveProject } from '@digigov/cli/lib';
7
+
8
+ const port = parseInt(process.env['PORT'] ?? '3000', 10);
9
+ const isDev = process.env.NODE_ENV !== 'production';
10
+
5
11
  const project = resolveProject();
6
12
  const devProxy = project.digigov.proxy;
7
- const path = require('path');
8
- const port = parseInt(process.env.PORT, 10) || 3000;
9
- const env = process.env.NODE_ENV;
10
- const dev = env !== 'production';
13
+
14
+ const require = createRequire(import.meta.url);
11
15
  const conf = require(path.join(project.root, 'next.config.js'));
12
- const app = next({
16
+
17
+ const app = next.default({
13
18
  dir: project.root, // base directory where everything is, could move to src later
14
- dev,
19
+ dev: isDev,
15
20
  conf,
16
21
  });
17
22
  const handle = app.getRequestHandler();
18
23
 
19
- const commandConfig = {
20
- '-p': {
21
- var: 'port',
22
- type: Number,
23
- default: 3000,
24
- },
25
- };
26
- const commandArgs = process.argv.slice(2)
27
- const vars = extractCommandArgs(commandConfig, commandArgs)
28
-
29
24
  app
30
25
  .prepare()
31
26
  .then(() => {
32
27
  const server = express();
33
28
 
34
29
  // Set up the proxy.
35
- if (dev && devProxy) {
30
+ if (isDev && devProxy) {
36
31
  const { createProxyMiddleware } = require('http-proxy-middleware');
37
- Object.keys(devProxy).forEach(function(context) {
32
+ Object.keys(devProxy).forEach(function (context) {
38
33
  server.use(createProxyMiddleware(context, devProxy[context]));
39
34
  });
40
35
  }
@@ -42,14 +37,12 @@ app
42
37
  // Default catch-all handler to allow Next.js to handle all other routes
43
38
  server.all('*', (req, res) => handle(req, res));
44
39
 
45
- server.listen(vars.port, err => {
46
- if (err) {
47
- throw err;
48
- }
40
+ server.listen(port, () => {
49
41
  console.log(`> Ready on port ${port}`);
50
42
  });
43
+ return;
51
44
  })
52
- .catch(err => {
45
+ .catch((err) => {
53
46
  console.log('An error occurred, unable to start the server');
54
47
  console.log(err);
55
48
  });
@@ -1,15 +1,26 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const glob = require('glob');
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import glob from 'globby';
4
4
 
5
5
  const FILE_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx'];
6
6
 
7
+ /**
8
+ * @typedef {"xs" | "lg"} ScreenSize
9
+ */
10
+
7
11
  const SCREEN_SIZES = {
8
- 'xs': { width: 375, height: 667, deviceScaleFactor: 1 },
9
- 'lg': { width: 1280, height: 720, deviceScaleFactor: 2 }
10
- }
12
+ xs: { width: 375, height: 667, deviceScaleFactor: 1 },
13
+ lg: { width: 1280, height: 720, deviceScaleFactor: 2 },
14
+ };
11
15
 
12
- const appendTestFile = (fileRelativePath, testFile, screenSizes) => {
16
+ /**
17
+ * Append test file with the test for the given file
18
+ *
19
+ * @param {string} fileRelativePath - The relative path of the file
20
+ * @param {string} testFile - The test file
21
+ * @param {ScreenSize[]} screenSizes - The screen sizes
22
+ */
23
+ function appendTestFile(fileRelativePath, testFile, screenSizes) {
13
24
  if (screenSizes.length > 0) {
14
25
  screenSizes.forEach((screenSize) => {
15
26
  testFile += `\ntest('${fileRelativePath.replace('index', '')} screen-${screenSize}', async () => {
@@ -20,8 +31,7 @@ const appendTestFile = (fileRelativePath, testFile, screenSizes) => {
20
31
  expect(screenshot).toMatchSnapshot();
21
32
  });\n`;
22
33
  });
23
- }
24
- else {
34
+ } else {
25
35
  testFile += `\ntest('${fileRelativePath.replace('index', '')}', async () => {
26
36
  await page.goto(\`\${baseUrl}${fileRelativePath.replace('index', '')}\`);
27
37
  await delay(SCREENSHOT_DELAY);
@@ -30,11 +40,16 @@ const appendTestFile = (fileRelativePath, testFile, screenSizes) => {
30
40
  expect(screenshot).toMatchSnapshot();
31
41
  });\n`;
32
42
  }
33
-
43
+
34
44
  return testFile;
35
45
  }
36
46
 
37
- const generateBrowserContexts = (screenSizes) => {
47
+ /**
48
+ * Generate browser contexts
49
+ *
50
+ * @param {ScreenSize[]} screenSizes - The screen sizes
51
+ */
52
+ function generateBrowserContexts(screenSizes) {
38
53
  let viewportSizes = '';
39
54
  if (screenSizes.length > 0) {
40
55
  screenSizes.forEach((screenSize) => {
@@ -44,49 +59,70 @@ const generateBrowserContexts = (screenSizes) => {
44
59
  deviceScaleFactor: ${SCREEN_SIZES[screenSize].deviceScaleFactor},
45
60
  });\n`;
46
61
  });
47
- }
48
- else {
62
+ } else {
49
63
  viewportSizes += `// Create a context with default screen size
50
64
  const context = await browser.newContext();\n`;
51
65
  }
52
-
66
+
53
67
  return viewportSizes;
54
68
  }
55
69
 
56
- const initializePages = (screenSizes) => {
70
+ /**
71
+ * Initialize pages
72
+ *
73
+ * @param {ScreenSize[]} screenSizes - The screen sizes
74
+ */
75
+ function initializePages(screenSizes) {
57
76
  let initializePages = '';
58
77
  if (screenSizes.length > 0) {
59
78
  screenSizes.forEach((screenSize) => {
60
79
  initializePages += `let page${screenSize.toUpperCase()};\n`;
61
80
  });
62
- }
63
- else {
81
+ } else {
64
82
  initializePages += 'let page;\n';
65
83
  }
66
-
84
+
67
85
  return initializePages;
68
86
  }
69
87
 
70
- const generateNewPages = (screenSizes) => {
88
+ /**
89
+ * Generate new pages
90
+ *
91
+ * @param {ScreenSize[]} screenSizes - The screen sizes
92
+ */
93
+ function generateNewPages(screenSizes) {
71
94
  let newPages = '';
72
95
  if (screenSizes.length > 0) {
73
96
  screenSizes.forEach((screenSize) => {
74
97
  newPages += `page${screenSize.toUpperCase()} = await context${screenSize.toUpperCase()}.newPage();\n`;
75
98
  });
76
- }
77
- else {
99
+ } else {
78
100
  newPages += 'page = await context.newPage();\n';
79
101
  }
80
-
102
+
81
103
  return newPages;
82
104
  }
83
105
 
84
- const generatePagesTestFile = (projectFolder, pagesPath = 'pages', baseUrl = 'http://localhost:3000', testFileName = 'index.spec.ts', screenSizes = []) => {
106
+ /**
107
+ * Generate pages test file
108
+ *
109
+ * @param {string} projectFolder - The project folder
110
+ * @param {string} [pagesPath="pages"] - The pages path
111
+ * @param {string} [baseUrl="http://localhost:3000"] - The base URL
112
+ * @param {string} [testFileName="index.spec.ts"] - The test file name
113
+ * @param {ScreenSize[]} [screenSizes=[]] - The screen sizes
114
+ */
115
+ function generatePagesTestFile(
116
+ projectFolder,
117
+ pagesPath = 'pages',
118
+ baseUrl = 'http://localhost:3000',
119
+ testFileName = 'index.spec.ts',
120
+ screenSizes = []
121
+ ) {
85
122
  let pagesFullPath = '';
86
123
  if (fs.existsSync(path.join(projectFolder, pagesPath))) {
87
124
  pagesFullPath = path.join(projectFolder, pagesPath);
88
- }
89
- else if (fs.existsSync(path.join(projectFolder, 'src', pagesPath))) {
125
+ } else if (fs.existsSync(path.join(projectFolder, 'src', pagesPath))) {
90
126
  pagesFullPath = path.join(projectFolder, `src/${pagesPath}`);
91
127
  }
92
128
  let testFile = `import { test, expect } from '@playwright/test';
@@ -115,17 +151,27 @@ ${generateNewPages(screenSizes)}
115
151
  });
116
152
  `;
117
153
 
118
- const pagesPathRegex = new RegExp(`.*${pagesFullPath.replace('/', '\\/')}(.*)`);
119
- glob.sync(`${pagesFullPath}/**/*.@(${FILE_EXTENSIONS.join('|')})`).forEach((fileFullPath) => {
120
- const fileRelativePath = fileFullPath.replace(pagesPathRegex, '$1');
121
- const pageFileName = fileRelativePath.substring(fileRelativePath.lastIndexOf('/') + 1);
122
- // Check of the file starts with letter or digit
123
- if(/^[a-zA-Z0-9]/.test(pageFileName)) {
124
- testFile = appendTestFile(fileRelativePath.replace(/\.[^/.]+$/, ''), testFile, screenSizes);
125
- }
126
- });
154
+ const pagesPathRegex = new RegExp(
155
+ `.*${pagesFullPath.replace('/', '\\/')}(.*)`
156
+ );
157
+ glob
158
+ .sync(`${pagesFullPath}/**/*.@(${FILE_EXTENSIONS.join('|')})`)
159
+ .forEach((fileFullPath) => {
160
+ const fileRelativePath = fileFullPath.replace(pagesPathRegex, '$1');
161
+ const pageFileName = fileRelativePath.substring(
162
+ fileRelativePath.lastIndexOf('/') + 1
163
+ );
164
+ // Check of the file starts with letter or digit
165
+ if (/^[a-zA-Z0-9]/.test(pageFileName)) {
166
+ testFile = appendTestFile(
167
+ fileRelativePath.replace(/\.[^/.]+$/, ''),
168
+ testFile,
169
+ screenSizes
170
+ );
171
+ }
172
+ });
127
173
  testFile += '\n});';
128
174
  fs.writeFileSync(path.join(projectFolder, testFileName), testFile);
129
175
  }
130
176
 
131
- module.exports = generatePagesTestFile;
177
+ export default generatePagesTestFile;
package/next.config.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./next.common').config
package/nextrc.js DELETED
@@ -1,5 +0,0 @@
1
- const {makeConfig} = require('@digigov/cli/lib');
2
-
3
- module.exports = (overrides)=>{
4
- return makeConfig(overrides, require('./next.common').config)
5
- }
package/postcss.config.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./postcss.common').config
package/postcssrc.js DELETED
@@ -1,5 +0,0 @@
1
- const {makeConfig} = require('@digigov/cli/lib');
2
-
3
- module.exports = (overrides)=>{
4
- return makeConfig(overrides, require('./postcss.common'))
5
- }