empty package
commit
7d69d9f8a5
|
@ -0,0 +1,23 @@
|
|||
|
||||
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
node_modules
|
||||
|
||||
# builds
|
||||
build
|
||||
dist
|
||||
.rpt2_cache
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
example/package-lock.json
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npm run precommit
|
|
@ -0,0 +1,20 @@
|
|||
# analytics-switch
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
// with npm
|
||||
npm i --save @flare/analytics-switch --registry https://toodle.ddns.net/public-node-registry
|
||||
|
||||
// with yarn
|
||||
yarn add @flare/analytics-switch --registry https://toodle.ddns.net/public-node-registry
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```jsx
|
||||
import {} from "@flare/analytics-switch";
|
||||
```
|
||||
|
||||
**1.0.0**
|
||||
This version includes the initial version of analytics-switch component.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"name": "@flare/analytics-switch",
|
||||
"version": "1.0.0",
|
||||
"description": "Analytics switch that includes integrations with Umami and Matomo",
|
||||
"author": {
|
||||
"name": "Tudor Stanciu",
|
||||
"email": "tudor.stanciu94@gmail.com",
|
||||
"url": "https://toodle.ddns.net/tsp"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://dev.azure.com/tstanciu94/Packages/_git/analytics-switch"
|
||||
},
|
||||
"private": true,
|
||||
"keywords": [
|
||||
"flare",
|
||||
"analytics",
|
||||
"umami",
|
||||
"matomo"
|
||||
],
|
||||
"main": "./src/index.js",
|
||||
"babel": {
|
||||
"presets": [
|
||||
"@babel/preset-react"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"prebuild": "rimraf build",
|
||||
"build": "npm run build:cjs && npm run build:copy-files",
|
||||
"build:cjs": "babel src -d build --copy-files",
|
||||
"build:copy-files": "node ./scripts/copy-files.js",
|
||||
"precommit": "lint-staged",
|
||||
"prepare": "husky install",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"prepush": "npm run build",
|
||||
"push": "cd build && npm publish --registry https://toodle.ddns.net/public-node-registry",
|
||||
"push:major": "npm run version:major && npm run push",
|
||||
"push:minor": "npm run version:minor && npm run push",
|
||||
"push:patch": "npm run version:patch && npm run push",
|
||||
"version:major": "npm version major --no-git-tag-version",
|
||||
"version:minor": "npm version minor --no-git-tag-version",
|
||||
"version:patch": "npm version patch --no-git-tag-version"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.16.7",
|
||||
"@babel/core": "^7.16.7",
|
||||
"@babel/node": "^7.16.7",
|
||||
"@babel/preset-env": "^7.16.7",
|
||||
"@babel/preset-react": "^7.8.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"fs-extra": "^10.0.0",
|
||||
"husky": "^7.0.4",
|
||||
"lint-staged": "^12.2.2",
|
||||
"prettier": "^2.5.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-scripts": "5.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"prop-types": "^15.8.1"
|
||||
},
|
||||
"prettier": {
|
||||
"trailingComma": "none",
|
||||
"tabWidth": 2,
|
||||
"semi": true,
|
||||
"singleQuote": false,
|
||||
"arrowParens": "avoid"
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.+(js|md|ts|css|sass|less|graphql|scss|json|vue)": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://toodle.ddns.net/public-node-registry"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/* eslint-disable no-console */
|
||||
const path = require("path");
|
||||
const fse = require("fs-extra");
|
||||
const glob = require("glob");
|
||||
|
||||
const packagePath = process.cwd();
|
||||
const buildPath = path.join(packagePath, "./build");
|
||||
const srcPath = path.join(packagePath, "./src");
|
||||
|
||||
/**
|
||||
* Puts a package.json into every immediate child directory of rootDir.
|
||||
* That package.json contains information about esm for bundlers so that imports
|
||||
* like import Typography from '@material-ui/core/Typography' are tree-shakeable.
|
||||
*
|
||||
* It also tests that an this import can be used in typescript by checking
|
||||
* if an index.d.ts is present at that path.
|
||||
*
|
||||
* @param {string} rootDir
|
||||
*/
|
||||
// async function createModulePackages({ from, to }) {
|
||||
// const directoryPackages = glob.sync('*/index.js', { cwd: from }).map(path.dirname);
|
||||
|
||||
// await Promise.all(
|
||||
// directoryPackages.map(async directoryPackage => {
|
||||
// const packageJson = {
|
||||
// sideEffects: false,
|
||||
// module: path.join('../esm', directoryPackage, 'index.js'),
|
||||
// typings: './index.d.ts',
|
||||
// };
|
||||
// const packageJsonPath = path.join(to, directoryPackage, 'package.json');
|
||||
|
||||
// /*const [typingsExist] =*/ await Promise.all([
|
||||
// //fse.exists(path.join(to, directoryPackage, 'index.d.ts')),
|
||||
// fse.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2)),
|
||||
// ]);
|
||||
|
||||
// // if (!typingsExist) {
|
||||
// // throw new Error(`index.d.ts for ${directoryPackage} is missing`);
|
||||
// // }
|
||||
|
||||
// return packageJsonPath;
|
||||
// }),
|
||||
// );
|
||||
// }
|
||||
|
||||
async function createPackageFile() {
|
||||
const packageData = await fse.readFile(
|
||||
path.resolve(packagePath, "./package.json"),
|
||||
"utf8"
|
||||
);
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { nyc, scripts, devDependencies, workspaces, ...packageDataOther } =
|
||||
JSON.parse(packageData);
|
||||
const newPackageData = {
|
||||
...packageDataOther,
|
||||
private: false,
|
||||
main: "./index.js"
|
||||
};
|
||||
const targetPath = path.resolve(buildPath, "./package.json");
|
||||
|
||||
await fse.writeFile(
|
||||
targetPath,
|
||||
JSON.stringify(newPackageData, null, 2),
|
||||
"utf8"
|
||||
);
|
||||
console.log(`Created package.json in ${targetPath}`);
|
||||
|
||||
fse.copy("./README.md", `${buildPath}/README.md`, err => {
|
||||
if (err) throw err;
|
||||
console.log("README file was copied to destination");
|
||||
});
|
||||
|
||||
return newPackageData;
|
||||
}
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
await createPackageFile();
|
||||
|
||||
//await createModulePackages({ from: srcPath, to: buildPath });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
|
@ -0,0 +1 @@
|
|||
export {};
|
Loading…
Reference in New Issue