Skip to content

Commit

Permalink
Merge pull request #59 from LuisEnMarroquin/develop
Browse files Browse the repository at this point in the history
Changed project structure to a yarn and lerna monorepo
  • Loading branch information
LuisEnMarroquin authored Dec 8, 2022
2 parents 5af755b + 35c45c0 commit 7bdb36e
Show file tree
Hide file tree
Showing 42 changed files with 13,689 additions and 18,820 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Production
name: Prod deploy

on:
push:
Expand All @@ -11,35 +11,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test
- name: Build JavaScript file
run: npm run build
- run: yarn
- run: yarn test
- run: yarn build
- name: Set environment variables
run: |
git fetch --all --tags
echo "TAG_VERSION=$(git describe --abbrev=0)" >> $GITHUB_ENV
echo "CURRENT_VERSION=$(node -e "console.log('v' + require('./package.json').version)")" >> $GITHUB_ENV
echo Env TAG_VERSION ${{ env.TAG_VERSION }} and CURRENT_VERSION ${{ env.CURRENT_VERSION }}
working-directory: packages/main-library/
- name: Publish package to NPM
if: ${{ env.TAG_VERSION != env.CURRENT_VERSION }}
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
npm publish --access public
env:
NPM_AUTH_TOKEN: ${{ secrets.TOKEN_NPM }}
working-directory: packages/main-library/
- name: Create GitHub release
if: ${{ env.TAG_VERSION != env.CURRENT_VERSION }}
run: |
echo ${{ secrets.TOKEN_GITHUB }} > nothing.md
gh auth login --with-token < nothing.md
gh release create ${{ env.CURRENT_VERSION }} -F README.md -t "Released ${{ env.CURRENT_VERSION }}"
- name: Build VueJS project
run: |
npm run build-client
cp CNAME dist/CNAME
- name: Prepare static files for deployment
run: yarn run static
- uses: JamesIves/[email protected]
with:
folder: dist
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test suite
name: Test suites

on: [push, pull_request_target]

Expand All @@ -7,7 +7,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test
- run: yarn
- run: yarn test
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Folders
dist/
build/
coverage/
node_modules/

# File managers
Expand All @@ -8,14 +10,11 @@ node_modules/
desktop.ini

# Other lockfiles
yarn.lock
package-lock.json
npm-shrinkwrap.json

# Log files
*.log*

# Excel files
*.xlsx

# Now this is a typescript project
src/index.js
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.14.2
38 changes: 16 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
# Dev environment
## Requirements

Here are the **node** and **npm** versions that we use to develop this project
These are the software versions I personally use

```shell
$ node --version && npm --version
v16.13.0
8.1.0
$ node --version
v16.14.2
$ npm --version
8.5.0
$ yarn --version
1.22.19
```

After cloning the repository, run `npm install` to install the dependencies
Other versions may work but I can not guarantee that

## Run in dev mode
## Develop locally

You'll have to use 2 consoles to run the app, one for the actual package `index.ts`
It will start the library and demo project in dev mode

```shell
$ npm run start
$ yarn start
```

Then if you want to test the package with `VueJS` you can execute the following
- Express: localhost:5500
- ReactJS: localhost:6500

```shell
$ npm run start-client
```

Otherwise if you want to test with `express` use the following command

```shell
$ npm run start-server
```

## Linting code
## Code linting

This project uses `prettier` for linting code

## Deploy to NPM

There is a pipeline for that, just do a PR and I'll merge it
There is a pipeline for that, just do a PR and it will be merged
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let data = [
let settings = {
fileName: "MySpreadsheet", // Name of the resulting spreadsheet
extraLength: 3, // A bigger number means that columns will be wider
writeMode: 'writeFile', // The available parameters are 'WriteFile' and 'write'. This setting is optional. Useful in such cases https://docs.sheetjs.com/docs/solutions/output#example-remote-file
writeMode: "writeFile", // The available parameters are 'WriteFile' and 'write'. This setting is optional. Useful in such cases https://docs.sheetjs.com/docs/solutions/output#example-remote-file
writeOptions: {}, // Style options from https://docs.sheetjs.com/docs/api/write-options
RTL: true, // Display the columns from right-to-left (the default value is false)
}
Expand Down Expand Up @@ -84,7 +84,6 @@ Examples

```js
// Number formats

"$0.00" // Basic
"#,##0.00" // Pound
"0%" // Percentage
Expand All @@ -99,7 +98,7 @@ Examples

## Examples

This are files used for development, please change imports from `../../src/index.js` to `json-as-xlsx`
This are files used for development, please change imports from `../../src/index` to `json-as-xlsx`

- [VueJS with JavaScript](https://github.com/LuisEnMarroquin/json-as-xlsx/blob/main/examples/vue-app/App.vue)
- [Express with TypeScript](https://github.com/LuisEnMarroquin/json-as-xlsx/blob/main/examples/express/server.ts)
- [Express with TypeScript](https://github.com/LuisEnMarroquin/json-as-xlsx/blob/main/packages/demo-express)
- [ReactJS with TypeScript](https://github.com/LuisEnMarroquin/json-as-xlsx/blob/main/packages/demo-reactjs)
72 changes: 0 additions & 72 deletions examples/vue-app/App.vue

This file was deleted.

10 changes: 0 additions & 10 deletions examples/vue-app/main.js

This file was deleted.

Binary file removed examples/vue-app/public/favicon.ico
Binary file not shown.
17 changes: 0 additions & 17 deletions examples/vue-app/public/index.html

This file was deleted.

5 changes: 0 additions & 5 deletions jest.config.js

This file was deleted.

6 changes: 6 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"packages": ["packages/*"],
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true
}
Loading

0 comments on commit 7bdb36e

Please sign in to comment.