Skip to content

Commit

Permalink
chore: modify for cdf
Browse files Browse the repository at this point in the history
  • Loading branch information
rgwozdz committed Aug 25, 2023
1 parent 2daee95 commit 17c166b
Show file tree
Hide file tree
Showing 232 changed files with 212 additions and 48,252 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: CI tests

on:
push:
branches: [ master ]
pull_request:
branches:
- master
- next
- beta
paths:
- "./.github/**.yml"
- "**/packages/**.js"
Expand Down Expand Up @@ -37,9 +31,6 @@ jobs:

- name: Lint
run: npm run lint:ci

- name: Unit tests
run: npm test --workspaces

- name: E2E tests
run: npm run test:e2e
73 changes: 0 additions & 73 deletions .github/workflows/codeql.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/dependabot-auto-merge.yml

This file was deleted.

72 changes: 0 additions & 72 deletions .github/workflows/release.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/synk-code-check.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/synk-dep-check.yml

This file was deleted.

2 changes: 1 addition & 1 deletion demo/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Koop = require('@koopjs/koop-core');
const Koop = require('../packages/core');
const provider = require('@koopjs/provider-file-geojson');

const koop = new Koop({ });
Expand Down
29 changes: 25 additions & 4 deletions fork-scripts/modify-fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ async function modifyPackageFiles() {
for (let i = 0; i < packages.length; i++) {
const filePath = path.join('../', packages[i], 'package.json');
const packageFile = require(filePath);
const name = packageFile.name.replace('@koopjs/', '');
const name = packageFile.name.replace('@koopjs/', '').replace('koop-', '');
const buildDest = `../../customdata/framework/${name}`;
const dependencies = stripKoopDeps(packageFile.dependencies);

await modifyJsonFile(
path.join(packages[i], 'package.json'),
{
name,
dependencies: stripKoopDeps(packageFile.dependencies),
author: undefined,
description: undefined,
keywords: undefined,
dependencies,
devDependencies: undefined,
files: undefined,
contributors: undefined,
Expand All @@ -39,14 +44,29 @@ async function modifyPackageFiles() {
types: undefined,
scripts: {
clean: `shx rm -rf ${buildDest} && shx rm package-lock.json`,
build: `shx mkdir ${buildDest} && shx cp package.json ${buildDest} && shx cp -r ./src ${buildDest} && shx cp -r ./node_modules ${buildDest}`,
build: generateBuildCmd(buildDest, dependencies),
},
},
{ ifFieldIsMissing: 'skip' },
);
}
}

function generateBuildCmd(buildDest, dependencies) {
const mkDir = `shx mkdir ${buildDest}`;
const cpPackage = `shx cp package.json ${buildDest}`;
const cpSrc = `shx cp -r ./src ${buildDest}`;

const build = `${mkDir} && ${cpPackage} && ${cpSrc}`;

if (Object.keys(dependencies).length === 0) {
return build;
}

const cpNodeModules = `shx cp -r ./node_modules ${buildDest}`;
return `${build} && ${cpNodeModules}`;
}

function stripKoopDeps(dependencies) {
return Object.entries(dependencies)
.filter(([key]) => {
Expand All @@ -70,6 +90,7 @@ async function deleteNonEssentialFiles() {
'!packages/**/LICENSE',
]);
await deleteAsync([
'packages/**/test',
'packages/**/.nycrc',
'packages/**/*.svg',
'packages/**/*.md',
Expand All @@ -82,7 +103,7 @@ async function deleteNonEssentialFiles() {
}

async function copyGithubAction() {
return copy(['fork-scripts/ci-tests.yml', '.github/workflows'], { up: true});
return copy(['fork-scripts/ci-tests.yml', '.github/workflows'], { up: true });
}

async function replacePackageReferences() {
Expand Down
Loading

0 comments on commit 17c166b

Please sign in to comment.