Skip to content

Commit

Permalink
Back to JS
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 committed Sep 22, 2021
1 parent a8dcde5 commit 63fad93
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 26 deletions.
2 changes: 2 additions & 0 deletions packages/docusaurus-plugin-ideal-image/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src
copyUntypedFiles.js
20 changes: 20 additions & 0 deletions packages/docusaurus-plugin-ideal-image/copyUntypedFiles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const path = require('path');
const fs = require('fs-extra');

/**
* Copy all untyped and static assets files to lib.
*/
const srcDir = path.resolve(__dirname, 'src');
const libDir = path.resolve(__dirname, 'lib');
fs.copySync(srcDir, libDir, {
filter(filepath) {
return !/__tests__/.test(filepath) && !/\.ts$/.test(filepath);
},
});
5 changes: 2 additions & 3 deletions packages/docusaurus-plugin-ideal-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
"version": "2.0.0-beta.6",
"description": "Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).",
"main": "lib/index.js",
"types": "src/plugin-ideal-image.d.ts",
"scripts": {
"build": "tsc",
"watch": "tsc --watch"
"build": "tsc && node copyUntypedFiles.js",
"watch": "node copyUntypedFiles.js && tsc --watch"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-ideal-image/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function (
name: 'docusaurus-plugin-ideal-image',

getThemePath() {
return path.resolve(__dirname, '../lib/theme');
return path.resolve(__dirname, './theme');
},

configureWebpack(_config: Configuration, isServer: boolean) {
Expand Down
18 changes: 0 additions & 18 deletions packages/docusaurus-plugin-ideal-image/src/plugin-ideal-image.d.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

import React from 'react';
import IdealImage from '@endiliey/react-ideal-image';
import type {Props} from '@theme/IdealImage';

function Image(props: Props): JSX.Element {
function Image(props) {
const {alt, className, img} = props;

// In dev env just use regular img with original file
Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus-plugin-ideal-image/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"rootDir": "src",
"outDir": "lib",
"noImplicitAny": false
"outDir": "lib"
}
}

0 comments on commit 63fad93

Please sign in to comment.